class CvsMessageExtractor
  def cvsMessage
    content = "#xumx #{Time.now.strftime("%Y-%m-%d")} \n";
    File.open("cvsMessage.txt") do |file|
      file.each_line{|line| (content += line.gsub(/\Wcvs\W/,"").gsub(/\,v\s*\W*\s*\w*\W*\w*/,"").gsub(/.xml.xml/,".xml").strip + "\n" if (nil == line.index("RCS file") && line =~/,v+/))}
      #when commit new files ,"RCS file" will be printed on the cvs console
      #when hbm.xml appear some error will be occur
    end
    puts content    
    content
  end

  def writeToFile(content)
    resultFile = open('sourcechange.txt', 'w')
    resultFile.print content
    resultFile.close        
  end
  
  def process
    writeToFile cvsMessage
  end
end

extractor = CvsMessageExtractor.new
extractor.process


#############################################################################
#                               file content                                #
#############################################################################     
#    Checking in java/src/com/onewaveinc/portalman/consumeauthority/presentation/isp/ConsumeAuthorityFormNew.java;
#    /cvs/cetus/java/src/com/onewaveinc/portalman/consumeauthority/presentation/isp/ConsumeAuthorityFormNew.java,v  <--  ConsumeAuthorityFormNew.java
#    new revision: 1.17; previous revision: 1.16
#    done
#    Checking in java/src/com/onewaveinc/portalman/consumeauthority/presentation/isp/ConsumeAuthorityActionNew.java;
#    /cvs/cetus/java/src/com/onewaveinc/portalman/consumeauthority/presentation/isp/ConsumeAuthorityActionNew.java,v  <--  ConsumeAuthorityActionNew.java
#    new revision: 1.51; previous revision: 1.50
#    done
#    Checking in java/dev/pages/ISP/administration/consumeAuthority_new/editDetailCondition.jsp;
#    /cvs/cetus/java/dev/pages/ISP/administration/consumeAuthority_new/editDetailCondition.jsp,v  <--  editDetailCondition.jsp
#    new revision: 1.34; previous revision: 1.33